package org.spring.learn.demo.annotation.configures.lazy;

import org.spring.learn.project.entity.Person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;

@Configuration
public class MyConfig {

    /**
     *  首先默认是类名首字母小写
     *  其次就是取方法名
     *  最后优先取Bean 注解的value
     * @return
     */
    @Lazy  // 延迟加载
    @Bean
    public Person person(){
        System.out.println("将对象添加到Ioc容器中");
        // 控制权反转
        return new Person("lisa",23);
    }

}
